package cn.myspringboot.exception;

import cn.myspringboot.constants.ErrorCode;

//全局异常
public class GlobalException extends RuntimeException{

    //用来把错误码传递给JsonResult对象
    private int code;

    public GlobalException(String message,int code){
        super(message);
        this.code = code;
    }

    public GlobalException(ErrorCode errorCode){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public GlobalException(String message){
        super(message);
    }
}
